<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
  <title>简单请求</title>
</head>
<body>
  <button id="btn">发请求</button>

  <script>
    let btn = document.getElementById('btn')
    btn.addEventListener('click', () => {
      $.ajax({
        method: 'get',
        url: 'http://localhost:3000/home',
        headers: {
          "Content-Type": "text/plain"
        },
        success(res) {
          console.log(res);
        }
      })
    })
  </script>
</body>
</html>